#pragma once

namespace a2d
{
//------------------------------------------------------------------
	
	class ShaderProgram
	{
	public:
		bool Create(const char *VertexSource, const char *FragmentSource);
		bool Load(const char *FileVertex, const char *FileFragment);
		void Bind();
		void Destroy();

		uint GetProgramID() { return m_prog; }

		sint SetUniform(const char *name, float f);
		sint SetUniform(const char *name, const glm::vec2 &v);
		sint SetUniform(const char *name, const glm::vec3 &v);
		sint SetUniform(const char *name, const glm::vec4 &v);
		sint SetUniform(const char *name, const glm::mat4 &matrix);
		
		void UpdateUniform(uint id, float f);
		void UpdateUniform(uint id, const glm::vec2 &v);
		void UpdateUniform(uint id, const glm::vec3 &v);
		void UpdateUniform(uint id, const glm::vec4 &v);
		void UpdateUniform(uint id, const glm::mat4 &matrix);

		sint GetAttrib(const char *name);
		sint GetUniform(const char *name);

	private:
		int status();
		char* fileread(const char* filename);
		uint m_prog = 0;
	};

//------------------------------------------------------------------
} // namespace a2d
